import { request } from '../../utils/request';

export interface LoginParams {
  username: string;
  password: string;
}

type TOKEN = string;

export interface IUserInfo {
  name: string;
  avatar: string;
  phone: string;
  sex: number;
}

export const login = (loginParams: LoginParams) =>
  request<TOKEN>({
    url: '/login',
    method: 'post',
    data: loginParams,
  });

export const getUserInfo = () =>
  request<IUserInfo>({
    url: '/user/info',
    method: 'post',
  });
